package com.example.demo1.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
@Slf4j
public class HttpAspect {

    @Pointcut("execution(* com.example.demo1.webapi.StudentRestController.*(..))")
    public void log(){

    }
    @Before("log()")
    public void doBefore(){
        System.out.println("准备开始运行list...");
    }
    @After("log()")
    public void doAfter(){
        System.out.println("执行list完，准备返回...");
    }
    @AfterReturning(returning = "object",pointcut = "log()")
    public void doAfterR(Object object){
        log.info("response={}",object);
    }


}
